
local MainScene = class("MainScene", cc.load("mvc").ViewBase)

local function TestBtn1(self, x, y)
    local images = {
        normal = "button/Button01.png",
        pressed = "button/Button01Pressed.png",
        disabled = "button/Button01Disabled.png",
    }

    ccui.Button:create(images.normal, images.pressed, images.disabled)
        :setScale9Enabled(true)
        :setTitleText("ui::Button")
        :setTitleFontSize(14)
        :setScaleX(2)
        :move(x, y)
        :addTo(self)
        :addClickEventListener(function(source) -- 按钮的clicked事件处理
            release_print("***ui::Button click***", source:getTitleText())
        end)
end

local function TestCheckBox1(self, x, y)
    local images = {
        bg = "button/CheckBoxButtonOn.png",
        cross = "button/CheckBoxButtonOffPressed.png",
    }

    ccui.CheckBox:create(images.bg, images.cross)
        :move(x, y)
        :addTo(self)
        :addEventListener(function(source, event)
            release_print("***checkbox click***, event", event)
        end)
end

function MainScene:onCreate()
    TestBtn1(self, display.cx, display.cy)
    TestCheckBox1(self, display.cx, display.cy - 100)
end

return MainScene
